package com.ruoyi.system.service.news.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.ruoyi.system.domain.news.NewsInspectManage;
import com.ruoyi.system.domain.news.query.NewsInspectManageQuery;
import com.ruoyi.system.domain.news.vo.NewsInspectManageVo;
import com.ruoyi.system.domain.news.vo.NewsInspectManageVo;
import com.ruoyi.system.mapper.news.NewsInspectManageMapper;
import com.ruoyi.system.service.news.NewsInspectManageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class NewsInspectManageServiceImpl extends ServiceImpl<NewsInspectManageMapper, NewsInspectManage>
        implements NewsInspectManageService {

    @Override
//    @DataScope(deptAlias = "t",userAlias = "t")
    public List<NewsInspectManageVo> getNewsInspectManageList(NewsInspectManageQuery newsInspectManageQuery) {
        if (newsInspectManageQuery.getIfPage()) {
            PageHelper.startPage(newsInspectManageQuery.getPageNum(), newsInspectManageQuery.getPageSize());
        }
        List<NewsInspectManageVo> newsInspectManageVoList = baseMapper.getNewsInspectManageList(newsInspectManageQuery);
        if (!newsInspectManageVoList.isEmpty() && newsInspectManageQuery.getId() == null) {
            for (NewsInspectManageVo newsInspectManageVo:newsInspectManageVoList) {
                newsInspectManageVo.setContent(null);
            }
        }
        return newsInspectManageVoList;
    }
}
